#include <iostream>
using namespace std;

typedef struct LNode {
    char data;
    LNode *next;
} LNode;

void CreateList(LNode *&head) {
    head = static_cast<LNode *>(malloc(sizeof(LNode)));
    head -> next = nullptr;
    LNode *p = head -> next;
    int n;
    char ch;
    cin >> n;
    for (int i = 0;i<n;i++) {
        cin >> ch;
        // 检查是否存在重复元素
        while (p != nullptr) {
            if (ch == p -> data)
                break;
            p = p -> next;
        }
        if (p == nullptr) {
            p = static_cast<LNode *>(malloc(sizeof(LNode)));
            p -> data = ch;
            p -> next = head -> next;
            head -> next = p;
        }
    }
}

void PrintList(LNode *head) {
    LNode *p = head -> next;
    while (p != nullptr) {
        cout << p -> data << " ";
        p = p -> next;
    }
    cout << endl;
}

int main() {
    LNode *head = nullptr;
    CreateList(head);
    PrintList(head);
    return 0;
}